package com.tpsix.util;

import lombok.experimental.UtilityClass;

import java.util.ArrayList;
import java.util.List;

@UtilityClass
public class ListUtil {

    public <T> List<T> castList(Object obj, Class<T> clazz) {
        List<T> result = new ArrayList<T>();
        if (obj instanceof List<?>) {
            List<?> objects = (List<?>) obj;
            for (Object o : objects) {
                result.add(clazz.cast(o));
            }
            return result;
        }
        return null;
    }

}
